﻿using System;
using System.Linq;
using System.Linq.Expressions;
using System.Collections.Generic;
using System.Data.Linq;
using System.Diagnostics.CodeAnalysis;

namespace Fuse8.DomainFramework.DataAccess.LinqDatabase
{
    /// <summary>
    /// 
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    public static class LinqEntityCompiledQuery<TEntity>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures",
            Justification = "CompiledQuery method signature requirements")]
        [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes",
            Justification = "This is anonimous delegate")]
        [SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible",
            Justification = "This is anonimous delegate")]
        public static Func<DataContext, IQueryable<TEntity>, IQueryable<TEntity>> PreCompile =
            CompiledQuery.Compile<DataContext, IQueryable<TEntity>, IQueryable<TEntity>>
               ((DataContext context, IQueryable<TEntity> func) => func);
    }
}
